<ion-view title="主题详情" >
	<ion-content>
		
		<ion-nav-buttons side="right">
			<button class="button button-icon icon ion-compose" ng-click="newReplieModal.show()"></button>
		</ion-nav-buttons>

		<progress ng-if="loading"></progress>

		<div style="padding: 50px; text-align: center;" class="padding" ng-if="topic.isNotExists">
			<h3>发主题的小伙伴良心发现后把它删掉了！</h3>
		</div>

		<div class="padding">
			<h3>{{ topic.title }}</h3>
			<div class="topic-content" ng-bind-html="topic.content"></div>
		</div>

		<div class="padding" ng-if="topic.title!=null">

			<div class="list list-replies" ng-if="topic.replies.length>
				0">
				<div class="item item-divider" style="border: 0;">{{ topic.replies.length }} 回复</div>
			</div>

			<button class="button button-block button-assertive" ng-if="topic.replies.length==0" ng-click="preReplie(null, topic.author.loginname)">消灭 0 回复</button>

			<div class="list list-replies" ng-repeat="replie in topic.replies track by $index">

				<div class="item item-avatar item-avatar-sm">
					<img src="{{ replie.author.avatar  | avatar}}" />
					<h4 ng-bind="replie.author.nickname"></h4>
					<p ng-bind="replie.create_at | fromNow"></p>
					<div class="buttons">
						<button class="button button-icon button-clear" ng-click="preReplie(replie.id, replie.author.nickname)"> <i class="icon ion-reply"></i>
						</button>
						<button class="button button-icon button-clear" ng-click="updateHeart(replie)"> <i class="icon ion-heart" ng-class="replie.ups.length>0 ? 'active' : null"></i>
						</button>
					</div>
				</div>
				<div class="item item-content" ng-bind-html="replie.content"></div>

			</div>
		</div>

	</ion-content>
	<div class="tabs tabs-energized tabs-icon-top">
		<a class="tab-item" ng-click="preReplie(topic.id,topic.author.nickname)">
			<i class="icon ion-ios-plus-outline"></i>
			回帖
		</a>
	</div>
</ion-view>